package com.cosina.mr;

import java.util.HashMap;
import java.util.Map;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;

public class MainActivity extends Activity {
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);
		
		findViewById(R.id.main_button_history).setOnClickListener(clickListener);
		findViewById(R.id.main_button_statistics).setOnClickListener(clickListener);
		findViewById(R.id.main_button_addRecord).setOnClickListener(clickListener);
	}
	
	private Map<Integer,Class<?>> activitiesMap = new HashMap<Integer,Class<?>>();
	{
		activitiesMap.put(R.id.main_button_history, RecordListActivity.class);
		activitiesMap.put(R.id.main_button_addRecord, EditRecordActivity.class);
		activitiesMap.put(R.id.main_button_statistics, StatisticsMain.class);
		
	}
	
	private OnClickListener clickListener = new OnClickListener(){

		@Override
		public void onClick(View v) {
			Class<?> actvities = activitiesMap.get(v.getId());
			Intent intent = new Intent(MainActivity.this,actvities);
			startActivity(intent);
		}
	};
	
	
}
